<?php use_helper('PA_Links') ?>
<?php use_helper('PA_Core') ?>
<!DOCTYPE html>
<html>
  <head>
    <?php include_http_metas() ?>
    <?php include_metas() ?>
    <?php include_title() ?>
    <link rel="shortcut icon" href="/favicon.ico" />
    <?php echo PACore::getStylesheets(array(), array('document.css')) ?>
    <?php echo PACore::getJavascripts() ?>
    <title> ProductionAssist </title>
    <script type="text/javascript">
      var defaultTab = 'StoreTab';
      var createItemUrl = '<?php if(!$sf_user->getAttribute("categoryObject")->getLocked()) echo link_to_app('Store', 'createItem', array('category' => $sf_request->getParameter('categoryName'))) ?>';
      <?php if($sf_user->hasFlash('info')) echo 'alert("'.$sf_user->getFlash('info').'");' ?>
    </script>
  </head>
  <body>
    <div class="cPage">
      <div class="cHeader">
        <div class="cRibbon">
          <div class="cTabs">
            <ul>
              <li class="active"><a href="#StoreTab"> Magazyn </a></li>
              <li class="inactive"><a href="#ProductionTab"> Produkcja </a></li>
              <?php if($sf_user->hasCredential('admin') || $sf_user->hasCredential('user')): ?>
              <li class="inactive"><a href="#SettingsTab"> Ustawienia </a></li>
              <?php endif; ?>
            </ul>
          </div>
          <div class="cIcons">
            <div class="active" id="StoreTab">
              <div class="cIconsGroup">
                <div class="cIcon">
                  <a href="<?php echo link_to_app('Store', 'categoryHomepage') ?>">
                    <img src="/images/icons/list.png" />
                    <p>Lista</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a onclick="App.loadWindow('<?php echo link_to_app('Store', 'searchItem', array('category' => $sf_request->getParameter('categoryName', 'Magazyn'))) ?>')">
                    <img src="/images/icons/search.png" /><p>Szukaj</p>
                  </a>
                </div>
                <div id="title">Materiał</div>
              </div>
              <div id="separator"></div>
              <div class="cIconsGroup">
                <div class="cIcon"><a onclick="App.loadContent('<?php echo link_to_app('Store', 'createOrder') ?>')"><img src="/images/icons/new_file.png" /><p>Nowe</p></a></div>
                <div class="cIcon"><a href="<?php echo link_to_app('Store', 'storeOrderHomepage') ?>"><img src="/images/icons/list.png" /><p>Realizowane</p></a></div>
                <div class="cIcon"><a href=""><img src="/images/icons/search.png" /><p>Szukaj</p></a></div>
                <div id="title">Zamówienie</div>
              </div>
              <div id="separator"></div>
              <div class="cIconsGroup">
                <div class="cIcon"><a onclick="App.loadContent('<?php echo link_to_app('Store', 'storeWzHomepage') ?>')"><img src="/images/icons/list.png" /><p>Lista</p></a></div>
                <div class="cIcon"><a href="<?php echo link_to_app('Store', 'createWz') ?>"><img src="/images/icons/new_file.png" /><p>Nowe WZ</p></a></div>
                <div id="title">Dokument</div>
              </div>
              <div id="separator"></div>
              <div class="cIconsPalette">
                <p><img src="http://placehold.it/20x20" /></p>
                <p><img src="http://placehold.it/20x20" /></p>
                <p><img src="http://placehold.it/20x20" /></p>
                <p><img src="http://placehold.it/20x20" /></p>
                <p><img src="http://placehold.it/20x20" /></p>
                <p><img src="http://placehold.it/20x20" /></p>
                <p><img src="http://placehold.it/20x20" /></p>
                <p><img src="http://placehold.it/20x20" /></p>
              </div>
            </div>
            <div class="inactive" id="ProductionTab">
              <div class="cIconsGroup">
                <div class="cIcon">
                  <a onclick="App.loadContent('<?php echo link_to_app('Production', 'selectCategory') ?>')">
                    <img src="/images/icons/new_file.png" />
                    <p>Nowe [Kategoria]</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a onclick="App.loadContent('<?php echo link_to_app('Production', 'selectDeliverer') ?>')">
                    <img src="/images/icons/new_file.png" />
                    <p>Nowe [Kontrahent]</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a onclick="App.loadContent('<?php echo link_to_app('Production', 'selectYawalXlsFile') ?>')">
                    <img src="/images/icons/new_file.png" />
                    <p>Nowe [YawalXls]</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a href="<?php echo link_to_app('Production', 'demandHomepage') ?>">
                    <img src="/images/icons/list.png" />
                    <p>Lista</p>
                  </a>
                </div>
                <div id="title">Zapotrzebowanie</div>
              </div>
              <div class="cIconsGroup">
                <div class="cIcon">
                  <a onclick="">
                    <img src="/images/icons/new_file.png" />
                    <p>Nowa</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a onclick="">
                    <img src="/images/icons/list.png" />
                    <p>Lista</p>
                  </a>
                </div>
                <div id="title">Konstrukcje</div>
              </div>
            </div>
            <?php if($sf_user->hasCredential('admin') || $sf_user->hasCredential('user')): ?>
            <div class="inactive" id="SettingsTab">
              <?php if($sf_user->hasCredential('admin')): ?>
              <div class="cIconsGroup">
                <div class="cIcon">
                  <a href="javascript:App.loadContent('<?php echo link_to_app('Core', 'categoriesSettings') ?>')">
                    <img src="" />
                    <p>Kategorie</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a href="javascript:App.loadWindow('<?php echo link_to_app('Core', 'homeGetComponent', array('componentModule' => 'StoreSettings', 'name' => 'manageParams')) ?>')">
                    <img src="/images/icons/params.png" />
                    <p>Parametry</p>
                  </a>
                </div>
                <div id="title">Magazyn</div>
              </div>
              <?php endif; ?>
              <div class="cIconsGroup">
                <div class="cIcon">
                  <a href="javascript:App.loadWindow('<?php echo link_to_app('Core', 'storeSettings') ?>')">
                    <img src="" />
                    <p>Magazyn</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a href="javascript:App.loadContent('<?php echo link_to_app('Core', 'productionSettings') ?>')">
                    <img src="" />
                    <p>Produkcja</p>
                  </a>
                </div>
                <?php if($sf_user->hasCredential('admin')): ?>
                <div class="cIcon">
                  <a href="javascript:App.loadContent('<?php echo link_to_app('Core', 'coreSettings') ?>')">
                    <img src="" />
                    <p>System</p>
                  </a>
                </div>
                <?php endif; ?>
                <div id="title">Moduły</div>
              </div>
              <div class="cIconsGroup">
                <div class="cIcon">
                  <a href="javascript:App.loadWindow('<?php echo link_to_app('Core', 'homeGetComponent', array('componentModule' => 'ProductionSettings', 'name' => 'manageDeliverers')) ?>')">
                    <img src="/images/icons/list.png" />
                    <p>Kontrahenci</p>
                  </a>
                </div>
                <div id="title">Inne</div>
              </div>
              <?php if($sf_user->hasCredential('admin')): ?>
              <div class="cIconsGroup">
                <div class="cIcon">
                  <a href="javascript:App.loadContent('<?php echo link_to_app('Core', 'homeGetComponent', array('componentModule' => 'Entry', 'name' => 'manageUsers')) ?>')">
                    <img src="/images/icons/list.png" />
                    <p>Lista</p>
                  </a>
                </div>
                <div class="cIcon">
                  <a onclick="App.loadWindow('<?php echo link_to_app('Core', 'homeGetComponent', array('componentModule' => 'Entry', 'name' => 'manageRoles')) ?>')">
                    <img src="/images/icons/list.png" />
                    <p>Role</p>
                  </a>
                </div>
                <div id="title">Użytkownicy</div>
              </div>
              <?php endif; ?>
            </div>
            <?php endif; ?>
            <div class="cInfo">
              <h1>Info</h1>
              <?php if($sf_user->getAttribute('userObject')): ?>
              <?php $userObject = $sf_user->getAttribute('userObject') ?>
              <p id="user">Imię i Nazwisko: </p>&nbsp;&nbsp;<span><?php echo ($userObject->getFirstName()." ".$userObject->getLastName() )?></span><br />
              <p id="lastLogin">Zalogowano: </p>&nbsp;&nbsp;<span><?php echo $userObject->getLastLogon() ?></span><br />
              <span id="submit_line" style="font-weight: normal">
              <img src="/images/icons/abort.png" class="middle" width="18" height="18"/>
              <a href="<?php echo link_to_app('Core', 'logout') ?>" class="middle">Wyloguj</a>
              </span>
              <?php else: ?>
              Brak danych
              <?php endif; ?>
            </div>
          </div>
        </div>
      </div>
      <div class="cBody">
        <div class="cContent">
          <?php echo $sf_content ?>
          <div class="cToolbox"></div>
        </div>
      </div>
      <div class="cFooter">
        <div class="cFooterContent">
          Copyright &copy; Paweł Świtalla 2011
        </div>
        <div class="cLogo"></div>
      </div>
    </div>
  </body>
</html>